package com.le.tester.javaThink.fifth.chapter18_Str;

import java.util.Scanner;

/**
 * createTime：2021/8/17 10:38
 * description：使用scan读取更好的字符
 */
public class BetterRead {
    //对比bufferRead,总是更好的选择
    public static void main(String[] args) {
        Scanner scanner = new Scanner(SimpleRead.in);
        System.out.println("What is your name");
        String name = scanner.nextLine();
        System.out.println(name);
        System.out.println("How old are you? What is you favorite double");
        System.out.println("(input: <age> <double>)");
        //注意有一个换行
        int age = scanner.nextInt();
        double favorite = scanner.nextDouble();
        System.out.println(age);
        System.out.println(favorite);
        System.out.format("Hi %s.%n", name);
        System.out.format("In 5 years you will be %d.%n", age + 5);
        System.out.format("My favorite double is %f.", favorite / 2);
    }
}
